
/*---------------------------------------------------------
   Name: gamemode:ScoreboardShow( )
   Desc: Sets the scoreboard to visible
---------------------------------------------------------*/
function GM:ScoreboardShow()
	GAMEMODE.ShowScoreboard = true
end

/*---------------------------------------------------------
   Name: gamemode:ScoreboardHide( )
   Desc: Hides the scoreboard
---------------------------------------------------------*/
function GM:ScoreboardHide()
	GAMEMODE.ShowScoreboard = false
end

Team = {Color( 125, 200, 100, 200 ),Color( 0, 111, 255, 200 ),Color( 220, 180, 0, 200 ),Color( 230, 230, 10, 200 )}

function GM:HUDDrawScoreBoard()
	if (!GAMEMODE.ShowScoreboard) then return end
	
	draw.RoundedBox( 0, (ScrW()/2-403), (ScrH()/2 - 353), 806, 585, Color( 111, 111, 111, 150 ) )
	surface.SetDrawColor( Color( 0, 180, 255, 150 ) )
	surface.DrawRect((ScrW()/2-400), (ScrH()/2 - 350), 800, 98)
	
local items = player.GetAll()
 
	draw.RoundedBox( 2, (ScrW()/2-398), (ScrH()/2 - 248), 700, 37, Team[items[1]:Team()] )
	draw.RoundedBox( 2, (ScrW()/2-398), (ScrH()/2 - 248), 700, 37, Team[items[1]:Team()] )
	draw.DrawText( items[1]:Nick(), "NameText", (ScrW()/2-390), (ScrH()/2 - 245),Color(255,255,255,255), 0 )
	draw.RoundedBox( 2, (ScrW()/2+305), (ScrH()/2 - 248), 93, 37, Color(math.Clamp((items[1]:Ping()-10),0,255),math.Clamp(((items[1]:Ping()*-1)+260),0,255),0,255) )
	draw.DrawText( "Ping: "..items[1]:Ping(), "NameText", (ScrW()/2 + 308), (ScrH()/2 - 245),Color(255,255,255,255), 0)

	if table.maxn(items) >= 2 then

    	draw.RoundedBox( 2, (ScrW()/2-398), (ScrH()/2 - 208), 700, 37, Team[items[2]:Team()] )
		draw.DrawText( items[2]:Nick(), "NameText", (ScrW()/2-390), (ScrH()/2 - 205), Color( 255, 255, 255, 255 ), 0 )
		draw.RoundedBox( 2, (ScrW()/2+305), (ScrH()/2 - 208), 93, 37, Color(math.Clamp((items[2]:Ping()-10),0,255),math.Clamp(((items[2]:Ping()*-1)+260),0,255),0,255) )
		draw.DrawText( "Ping: "..items[2]:Ping(), "NameText", (ScrW()/2 + 308), (ScrH()/2 - 205),Color(255,255,255,255), 0)
	
		if table.maxn(items) >= 3 then
 
			draw.RoundedBox( 2, (ScrW()/2-398), (ScrH()/2 - 168), 700, 37, Team[items[3]:Team()] )
			draw.DrawText( items[3]:Nick(), "NameText", (ScrW()/2-390), (ScrH()/2 - 165), Color( 255, 255, 255, 255 ), 0 )
			draw.RoundedBox( 2, (ScrW()/2+305), (ScrH()/2 - 168), 93, 37, Color(math.Clamp((items[3]:Ping()-50),0,255),math.Clamp(((items[3]:Ping()*-1)+260),0,255),0,255) )
			draw.DrawText( "Ping: "..items[3]:Ping(), "NameText", (ScrW()/2 + 308), (ScrH()/2 - 165),Color(255,255,255,255), 0)
		
			if table.maxn(items) >= 4 then
 
				draw.RoundedBox( 2, (ScrW()/2-398), (ScrH()/2 - 128), 700, 37, Team[items[4]:Team()] )
				draw.DrawText( items[4]:Nick(), "NameText", (ScrW()/2-390), (ScrH()/2 - 125), Color( 255, 255, 255, 255 ), 0 )
				draw.RoundedBox( 2, (ScrW()/2+305), (ScrH()/2 - 128), 93, 37, Color(math.Clamp((items[4]:Ping()-10),0,255),math.Clamp(((items[4]:Ping()*-1)+260),0,255),0,255) )
				draw.DrawText( "Ping: "..items[4]:Ping(), "NameText", (ScrW()/2 + 308), (ScrH()/2 - 125),Color(255,255,255,255), 0)
			
				if table.maxn(items) >= 5 then
					
					draw.RoundedBox( 2, (ScrW()/2-398), (ScrH()/2 - 88), 700, 37, Team[items[5]:Team()] )
					draw.DrawText( items[5]:Nick(), "NameText", (ScrW()/2-390), (ScrH()/2 -	85), Color( 255, 255, 255, 255 ), 0 )
					draw.RoundedBox( 2, (ScrW()/2+305), (ScrH()/2 - 88), 93, 37, Color(math.Clamp((items[5]:Ping()-10),0,255),math.Clamp(((items[5]:Ping()*-1)+260),0,255),0,255) )
					draw.DrawText( "Ping: "..items[5]:Ping(), "NameText", (ScrW()/2 + 308), (ScrH()/2 - 85),Color(255,255,255,255), 0)
				
					if table.maxn(items) >= 6 then
	
						draw.RoundedBox( 2, (ScrW()/2-398), (ScrH()/2 - 48), 700, 37, Team[items[6]:Team()] )
						draw.DrawText( items[6]:Nick(), "NameText", (ScrW()/2-390), (ScrH()/2 - 45), Color( 255, 255, 255, 255 ), 0 )
						draw.RoundedBox( 2, (ScrW()/2+305), (ScrH()/2 - 48), 93, 37, Color(math.Clamp((items[6]:Ping()-10),0,255),math.Clamp(((items[6]:Ping()*-1)+260),0,255),0,255) )
						draw.DrawText( "Ping: "..items[6]:Ping(), "NameText", (ScrW()/2 + 308), (ScrH()/2 - 45),Color(255,255,255,255), 0)
					
						if table.maxn(items) >= 7 then
	
							draw.RoundedBox( 2, (ScrW()/2-398), (ScrH()/2 - 8), 700, 37, Team[items[7]:Team()] )
							draw.DrawText( items[7]:Nick(), "NameText", (ScrW()/2-390), (ScrH()/2 - 5), Color( 255, 255, 255, 255 ), 0 )
							draw.RoundedBox( 2, (ScrW()/2+305), (ScrH()/2 - 8), 93, 37, Color(math.Clamp((items[7]:Ping()-10),0,255),math.Clamp(((items[7]:Ping()*-1)+260),0,255),0,255) )
							draw.DrawText( "Ping: "..items[7]:Ping(), "NameText", (ScrW()/2 + 308), (ScrH()/2 - 5),Color(255,255,255,255), 0)
						
							if table.maxn(items) >= 8 then
	
								draw.RoundedBox( 2, (ScrW()/2-398), (ScrH()/2 + 32), 700, 37, Team[items[8]:Team()] )
								draw.DrawText( items[8]:Nick(), "NameText", (ScrW()/2-390), (ScrH()/2 + 35), Color( 255, 255, 255, 255 ), 0 )
								draw.RoundedBox( 2, (ScrW()/2+305), (ScrH()/2 + 32), 93, 37, Color(math.Clamp((items[8]:Ping()-10),0,255),math.Clamp(((items[8]:Ping()*-1)+260),0,255),0,255) )
								draw.DrawText( "Ping: "..items[8]:Ping(), "NameText", (ScrW()/2 + 308), (ScrH()/2 + 35),Color(255,255,255,255), 0)
							
								if table.maxn(items) >= 9 then
	
									draw.RoundedBox( 2, (ScrW()/2-398), (ScrH()/2 + 72), 700, 37, Team[items[9]:Team()] )
									draw.DrawText( items[9]:Nick(), "NameText", (ScrW()/2-390), (ScrH()/2 + 75), Color( 255, 255, 255, 255 ), 0 )
									draw.RoundedBox( 2, (ScrW()/2+305), (ScrH()/2 + 72), 93, 37, Color(math.Clamp((items[9]:Ping()-10),0,255),math.Clamp(((items[9]:Ping()*-1)+260),0,255),0,255) )
									draw.DrawText( "Ping: "..items[9]:Ping(), "NameText", (ScrW()/2 + 308), (ScrH()/2 + 75),Color(255,255,255,255), 0)
								
									if table.maxn(items) >= 10 then
	
										draw.RoundedBox( 2, (ScrW()/2-398), (ScrH()/2 + 112), 700, 37, Team[items[10]:Team()] )
										draw.DrawText( items[10]:Nick(), "NameText", (ScrW()/2-390), (ScrH()/2 + 115), Color( 255, 255, 255, 255 ), 0 )
										draw.RoundedBox( 2, (ScrW()/2+305), (ScrH()/2 + 112), 93, 37, Color(math.Clamp((items[10]:Ping()-10),0,255),math.Clamp(((items[10]:Ping()*-1)+260),0,255),0,255) )
										draw.DrawText( "Ping: "..items[10]:Ping(), "NameText", (ScrW()/2 + 308), (ScrH()/2 + 115),Color(255,255,255,255), 0)
									
										if table.maxn(items) >= 11 then
	
											draw.RoundedBox( 2, (ScrW()/2-398), (ScrH()/2 + 152), 700, 37, Team[items[11]:Team()] )
											draw.DrawText( items[11]:Nick(), "NameText", (ScrW()/2-390), (ScrH()/2 + 155), Color( 255, 255, 255, 255 ), 0 )
											draw.RoundedBox( 2, (ScrW()/2+305), (ScrH()/2 + 152), 93, 37, Color(math.Clamp((items[11]:Ping()-10),0,255),math.Clamp(((items[11]:Ping()*-1)+260),0,255),0,255) )
											draw.DrawText( "Ping: "..items[11]:Ping(), "NameText", (ScrW()/2 + 308), (ScrH()/2 + 155),Color(255,255,255,255), 0)
											
											if table.maxn(items) >= 12 then
			
												draw.RoundedBox( 2, (ScrW()/2-398), (ScrH()/2 + 192), 700, 37, Team[items[12]:Team()] )
												draw.DrawText( items[12]:Nick(), "NameText", (ScrW()/2-390), (ScrH()/2 + 195), Color( 255, 255, 255, 255 ), 0 )
												draw.RoundedBox( 2, (ScrW()/2+305), (ScrH()/2 + 192), 93, 37, Color(math.Clamp((items[12]:Ping()-10),0,255),math.Clamp(((items[12]:Ping()*-1)+260),0,255),0,255) )
												draw.DrawText( "Ping: "..items[12]:Ping(), "NameText", (ScrW()/2 + 308), (ScrH()/2 + 195),Color(255,255,255,255), 0)
											end
										end
									end
								end
							end
						end
					end
				end
			end
		end
	end
	draw.DrawText( tostring(GetConVarString("hostname")), "HostnameText", (ScrW()/2-370), (ScrH()/2 - 340), Color( 255, 255, 255, 255 ), 0 )
	
	/*draw.DrawText( "Props: " .. tostring(LocalPlayer():GetEyeTraceNoCursor().Entity:GetCount("props")), "ScoreboardText", (ScrW()-350), (ScrH() - 92), Color( 200, 200, 200, 255 ), 0 )
	draw.DrawText( "Rank: " .. tostring(team.GetName(LocalPlayer():GetEyeTraceNoCursor().Entity:Team())), "ScoreboardText", (ScrW()-350), (ScrH() - 70), Color( 200, 200, 200, 255 ), 0 )
	draw.DrawText( "Ping: " .. tostring(LocalPlayer():GetEyeTraceNoCursor().Entity:Ping()), "ScoreboardText", (ScrW()-350), (ScrH() - 50), Color( 200, 200, 200, 255 ), 0 )
	draw.DrawText( tostring(LocalPlayer():GetEyeTraceNoCursor().Entity:Nick()), "ScoreboardText", (ScrW()-350), (ScrH() - 138), Color( 255, 255, 255, 255 ), 0 )*/
end

